<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>

<configuration>

  <property>
    <name>javax.jdo.option.ConnectionURL</name>
    <value>jdbc:postgresql://{{ groups['postgresql'][0] }}/metastore</value>
    <description>JDBC connect string for a JDBC metastore</description>
  </property>

  <property>
    <name>javax.jdo.option.ConnectionDriverName</name>
    <value>org.postgresql.Driver</value>
    <description>Driver class name for a JDBC metastore</description>
  </property>

  <property>
    <name>javax.jdo.option.ConnectionUserName</name>
    <value>hiveuser</value>
  </property>

  <property>
    <name>javax.jdo.option.ConnectionPassword</name>
    <value>{{ hiveuser_password }}</value>
  </property>

  <property>
    <name>datanucleus.autoCreateSchema</name>
    <value>false</value>
  </property>

  <property>
    <name>datanucleus.fixedDatastore</name>
    <value>true</value>
  </property>

  <property>
    <name>datanucleus.autoStartMechanism</name>
    <value>SchemaTable</value>
  </property>

  <property>
    <name>hive.metastore.uris</name>
    <value>thrift://{{ groups['hivemetastore'][0] }}:9083</value>
    <description>IP address (or fully-qualified domain name) and port of the metastore host</description>
  </property>

  <property>
    <name>hive.metastore.schema.verification</name>
    <value>true</value>
  </property>

{% if groups['zookeepernodes']|count >0 %}
  <property>
    <name>hive.support.concurrency</name>
    <value>true</value>
    <description>Enable Hive's Table Lock Manager Service</description>
  </property>

  <property>
    <name>hive.zookeeper.quorum</name>
    <description>Zookeeper quorum used by Hive's Table Lock Manager</description>
    <value>{% for item in groups['zookeepernodes'] -%}
           {{ item }}{% if not loop.last %},{% endif %}
           {%- endfor %}</value>
  </property>
{% else %}
  <property>
    <name>hive.support.concurrency</name>
    <value>false</value>
    <description>Enable Hive's Table Lock Manager Service</description>
  </property>
{% endif %}

  <property>
    <name>hive.server2.thrift.port</name>
    <value>10000</value>
    <description>TCP port number to listen on, default 10000</description>
  </property>

  <property>
    <name>hive.metastore.client.socket.timeout</name>
    <value>3600</value>
    <description>MetaStore Client socket timeout in seconds</description>
  </property>

  <property>
    <name>hive.exec.compress.intermediate</name>
    <value>true</value>
  </property>

  <property>
    <name>hive.exec.compress.output</name>
    <value>true</value>
  </property>

  <property>
    <name>mapred.output.compression.codec</name>
    <value>org.apache.hadoop.io.compress.SnappyCodec</value>
  </property>

  <property>
    <name>mapred.map.output.compression.codec</name>
    <value>org.apache.hadoop.io.compress.SnappyCodec</value>
  </property>

  <property>
    <name>hive.exec.reducers.bytes.per.reducer</name>
    <value>200000000</value>
  </property>

  <property>
    <name>hive.exec.dynamic.partition</name>
    <value>true</value>
  </property>

  <property>
    <name>hive.exec.dynamic.partition.mode</name>
    <value>nonstrict</value>
  </property>

  <property>
    <name>parquet.compression</name>
    <value>SNAPPY</value>
  </property>

  <property>
    <name>mapred.output.compression.type</name>
    <value>BLOCK</value>
  </property>

  <property>
    <name>mapred.reduce.tasks</name>
    <value>-1</value>
  </property>

  <property>
    <name>hive.mapred.reduce.tasks.speculative.execution</name>
    <value>false</value>
  </property>

  <property>
    <name>hive.optimize.sort.dynamic.partition</name>
    <value>false</value>
  </property>

</configuration>
